﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeMilkerV2.Models;

namespace CodeMilkerV2.Repositories {
    public class DataTypeRepository {
        public DataType GetDataType(string dataTypeName) {
            return GetAll().Where(d => d.Name == dataTypeName).Single();
        }

        public IList<DataType> GetAll() {
            var datatypes = new List<DataType>
            {
                new DataType{ Id=1,Name="Guid", CsType = "Guid", DbType = "uniqueidentifier", Ctrl=null},
                new DataType{ Id=2,Name="Text", CsType = "string", DbType = "nvarchar", Ctrl="@Html.TextBoxFor({0})"},
                new DataType{ Id=3,Name="Int", CsType = "int", DbType = "int", Ctrl="@Html.TextBoxFor({0})"},
                new DataType{ Id=4,Name="Boolean", CsType = "bool", DbType = "bit", Ctrl="chk"},
                new DataType{ Id=5,Name="Date", CsType = "DateTime", DbType = "datetime", Ctrl="@Html.TextBoxFor({0})"},
                new DataType{ Id=6,Name="Money", CsType = "decimal", DbType = "money", Ctrl="@Html.TextBoxFor({0})"},
                new DataType{ Id=7,Name="Doc", CsType = "byte[]", DbType = "image", Ctrl="file"},
                new DataType{ Id=8,Name="Image", CsType = "byte[]", DbType = "image", Ctrl="file"},
                new DataType{ Id=9,Name="lov", CsType = "int", DbType = "int", Ctrl="ddl"},
                new DataType{ Id=10,Name="Decimal", CsType = "decimal", DbType = "decimal", Ctrl="txt"},
                new DataType{ Id=11,Name="nText", CsType = "string", DbType = "nvarchar(max)", Ctrl="ntxt"},
                new DataType{ Id=12,Name="Enum", CsType = "int", DbType = "int", Ctrl="ddl"},
                 new DataType{ Id=13,Name="Ver", CsType = "Ver", DbType = "timestamp", Ctrl=""}
            };

            return datatypes;
        }
    }
}
